﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<WebClient.Models.ViewModels.GroupViewModel>" %>
<script type="text/javascript">
    $(function () {
        focusOnTaiKhoan();
        focusOnMatKhau();
        lostFocusOnTaiKhoan();
        lostFocusOnMatKhau();
    });
    function focusOnTaiKhoan() {
        $('#LogOn_UserName').focus(function () {
            if (this.value == 'UserName') {
                this.value = '';
                this.style.color = 'white';
            }
        });
    }
    function lostFocusOnTaiKhoan() {
        $('#LogOn_UserName').blur(function () {
            if (this.value == '') {
                this.value = 'UserName';
                this.style.color = 'white';
            }
        });
    }
    function focusOnMatKhau() {
        $('#LogOn_Password').focus(function () {
            if (this.value == 'Password') {
                this.value = '';
                this.style.color = 'white';
            }
        });
    }
    function lostFocusOnMatKhau() {
        $('#LogOn_Password').blur(function () {
            if (this.value == '') {
                this.value = 'Password';
                this.style.color = 'white';
            }
        });
    }
</script>
<center>
    <div id="div1">
        <div id="div3">
            <a href="<%= Url.Action("Index", "Home") %>">
                <img src="../../../Content/Images/Home/vf.png" alt="Order food online" width="324" height="75" border="0" />
            </a>
        </div>
        <div id="div1b">
            <br>
        </div>
    </div>
    <div id="div2">
        <div id="div1aa">
            <div id="toplinks" class="toplinks">
                <%
                    var isAuthenticated = false;
                    // Look username
                    HttpCookie SlmMemberCookie = new HttpCookie("SLMFMembers");
                    SlmMemberCookie = HttpContext.Current.Request.Cookies["SLMFMembers"];
                    var strUser = "";
                    if (SlmMemberCookie != null && SlmMemberCookie.Value != "" &&
                         SlmMemberCookie.Value != null)
                    {
                        strUser = SlmMemberCookie.Value.ToString();
                    }
                    
                    // Look password
                    HttpCookie SlmSessionId = new HttpCookie("SLMFSessionId");
                    SlmSessionId = HttpContext.Current.Request.Cookies["SLMFSessionId"];
                    if (SlmSessionId != null && SlmSessionId.Value != "" &&
                         SlmSessionId.Value != null)
                    {
                        string strSessionId = SlmSessionId.Value.ToString();
                        var errtxt = string.Empty;
                        var username = strUser;
                        if ((errtxt = DALService.Instance.Validation_ValidateUser(username, strSessionId)) == string.Empty)
                        {
                            isAuthenticated = true;
                        }
                    }
                 %>
                <% if (isAuthenticated)
                   {
                       var user = Model.UsersModel.GetModel.LstObjModel[0];    
                %>
                    <ul class="isuser">
                        <li class="welcomelink"><span style="font-weight:bold; color:#ffffff; text-align: right;">Hi, <a href="<%= Url.Action("UserInfo", "Account", new { username = strUser }) %>"><b><%= strUser%></b></a></span></li>
                        <li>|</li>
			            <li><%= Html.ActionLink("LogOff", "LogOffHome", "Account")%></li>    
                        <li>|</li>
			            <li><%= Html.ActionLink("Change Password", "ChangePassword", "Account")%></li>   
                        <%
                            if (user.Role.Name.ToUpper() == "ADMIN" || user.Role.Name.ToUpper() == "MANAGER")
                            { 
                        %>
                            <li>|</li>
			                <li><%= Html.ActionLink("Admin Page", "Index", "Admin")%></li>  
                         <% } %>  
                        <li>|</li>
			            <li>
                            <a href="<%= Url.Action("OrdersHistory", "Home", new { iduser = user.ID }) %>" title="OrdersHistory"  class='current'>Orders History</a>
                        </li>     
		            </ul>
                <% }
                    else
                    { %>
                        <ul class="nouser">
                        <% using (Html.BeginForm("LogOn", "Account"))
                            { %>
                            <fieldset id="logindetails" class="logindetails">
                                <li>
                                    <%: Html.TextBox("LogOn_UserName", "UserName", new { size = 15, id = "LogOn_UserName" })%>
                                    <%: Html.Password("LogOn_Password", "Password", new { size = 15, id = "LogOn_Password" })%>
                                    <%= Html.Hidden("navbar_url", this.Url.RouteUrl(this.ViewContext.RouteData.Values))%>
                                    <input type="submit" class="loginbutton" tabindex="104" value="&nbsp;" title="Enter your Username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" />
                                </li>
                                <li class="registertop">	
                                    <a href="<%: Url.Action("Register", "Account") %>"><b>Register</b>&nbsp;&nbsp;&nbsp;</a>
                                </li>
                                <li style="padding-top: 3px;">|</li>
                                <li class="registertop">	
                                    <a href="<%: Url.Action("ResetPassword", "Account") %>"><b>Forgot password</b>&nbsp;</a>
                                </li>
                            </fieldset>
                        <% } %>
                        </ul>
                <% } %>
            </div>
	    </div>
        <div id="div1a">
            <a href="<%= Url.Action("Index", "Home") %>" title="Homepage"  class='current'>Homepage</a> | 
            <a id="ftlinks" href="javascript:popup()">Tell A Friend</a> |
            <a href="<%= Url.Action("Contact", "Home") %>" title="Contact"  >Contact</a>
        	&nbsp;<br />
	    </div>
        <div id="div4">
		    <!-- BEGIN ProvideSupport.com Graphics Chat Button Code -->
            <div id="cieiKV" style="z-index:100;position:absolute;"></div>
            <div id="sceiKV" style="display:inline; margin-right: 5px;"></div>
            <div id="sdeiKV" style="display:none"></div>
            <!-- END ProvideSupport.com Graphics Chat Button Code -->
        </div>
    </div>
    <% if (Request.Path.Contains("Order") || Request.Path.Contains("SelectRestaurants") || Request.Path.Contains("Approve"))
       { %> 
    <% }
       else
       { %>
        <div style="height: 20px;">
        </div>
    <% } %>
  
</center>

